#include <iostream>
#include <cmath>

int* findNarcissisticNumbers(int& count) {
    const int LOWER_LIMIT = 100;
    const int UPPER_LIMIT = 999;

    int tempCount = 0;
    for (int i = LOWER_LIMIT; i <= UPPER_LIMIT; i++) {
        int num = i;
        int sum = 0;
        while (num != 0) {
            int digit = num % 10;
            sum += std::pow(digit, 3);
            num /= 10;
        }
        if (sum == i) {
            tempCount++;
        }
    }

    count = tempCount;
    int* numbers = new int[count];

    int index = 0;
    for (int i = LOWER_LIMIT; i <= UPPER_LIMIT; i++) {
        int num = i;
        int sum = 0;
        while (num != 0) {
            int digit = num % 10;
            sum += std::pow(digit, 3);
            num /= 10;
        }
        if (sum == i) {
            numbers[index++] = i;
        }
    }

    return numbers;
}

int main() {
    int count = 0;
    int* narcissisticNumbers = findNarcissisticNumbers(count);

    std::cout << "水仙花数的个数: " << count << std::endl;
    std::cout << "水仙花数列表: ";
    for (int i = 0; i < count; i++) {
        std::cout << narcissisticNumbers[i] << " ";
    }
    std::cout << std::endl;

    delete[] narcissisticNumbers;

    return 0;
}